<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ include file="../common/tag.jsp"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>在线考试_阅学网</title>
<meta name="Keywords" content="在线考试">
<meta name="description" content="考试题库">
<%@ include file="../common/common.jsp"%>
</head>
<body>
	<jsp:include page="../top.jsp"></jsp:include>
	<div class="step-detail" >
		<span>
			<a href="public/index">首页</a>>>
			<a href="public/examList">在线考试</a>
		</span>
	</div>
	<div class="yc_container">
			<div class="paper-list-left">
				<div class="paper-list-left-page-top">
					<c:forEach items="${examTypeList }" var="examType">
						<div class="paper-list-left-detail">
							<img alt="${examType.examSubjectName }" src="images/paper.png" />
							<div class="paper-list-left-detail-title" >
								<div class="paper-list-left-detail-title-name">
									<c:choose>
										<c:when test="${fn:length(examType.examSubjectName) > 12}">${fn:substring(examType.examSubjectName, 0, 12)}......</c:when>
										<c:otherwise> ${examType.examSubjectName }</c:otherwise>
									</c:choose>
								</div>
								<a href="public/exam/examPaperTypeDetail/${examType.id }" title="${examType.examSubjectName }">
									<span class="paper-list-left-detail-enter">进入题库</span>
								</a>
							</div>
						</div>
					</c:forEach>
				</div>
				<div class="pagination-bar">
						<div class="pagination-bar-left"><span>共${page.totalCount}条记录&nbsp;${page.totalPageCount}页</span></div>
						<div class="pagination-bar-right">
							<span><a href="public/bookList?pageNow=1">首页</a></span>
							<c:choose>
								<c:when test="${page.pageNow -1 >0}">
									<span>
										<a href="public/bookList?pageNow=${page.pageNow-1}">&lt;</a>
									</span>
								</c:when>
							</c:choose>
							<%-- 计算页码列表的开始和结束位置，即两个变量begin和end --%>
							<c:choose>
								<c:when test="${page.totalPageCount <=2}">
									<c:set var="begin" value="1"></c:set>
									<c:set var="end" value="${page.totalPageCount }"></c:set>
								</c:when>
								<c:otherwise>
									<c:set var="begin" value="${page.pageNow-2 }"/>
	 								<c:set var="end" value="${page.pageNow + 2}"/>
	 								<c:if test="${begin <=1 }">
										<c:set var="begin" value="1"/>
	 								</c:if>
	 								<c:if test="${end>=page.totalPageCount }">
	 									<c:set var="end" value="${page.totalPageCount }"/>
	 								</c:if>
								</c:otherwise>
							</c:choose>
							<%--页码 --%>
							<c:forEach begin="${begin }" end="${end}" var="pageIndex">
									<c:choose>
										<c:when test="${page.pageNow==pageIndex}">
											<span>
												<a href="javascript:void(0);"style="float: left; background: #EAEAEA;">${pageIndex }</a>
											</span>
										</c:when>
										<c:otherwise>
											<span>
												<a href="public/bookList?pageNow=${pageIndex}" target="_self">${pageIndex }</a>
											</span>
										</c:otherwise>
									</c:choose>
							</c:forEach>
							<%-- 显示当前页后面点点点 --%>
							<c:if test="${end< page.totalPageCount}">
								<span>
									<a  href="javascript:void(0);">...</ a>
								</span>
							</c:if>
							<c:choose>
								<c:when test="${page.pageNow <page.totalPageCount}">
									<span>
										<a href="public/bookList?pageNow=${page.pageNow+1 }" target="_self">&gt;</a>
									</span>
								</c:when>
							</c:choose>
							<span>
								<a href="public/bookList?pageNow=${page.totalPageCount}">末页</a>
							</span>
					</div>
				</div>
			</div>
			
			<div class="book-list-right">
				1122
			</div>
	</div>
	<footer class="yc_footer">
		<jsp:include page="../bottom.jsp"></jsp:include>
	</footer>
</body>
</html>